package main

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
)


type ApiData struct {
	Success bool `json:"success"`
	Message string `json:"message"`
	Result ResultData
}

type ResultData struct {
	MaxPage int  `json:"maxPageSize"`
	CreditRule  interface{} `json:"credit_rule"`
	CurrencyId  interface{}  `json:"currency_id"`
}


func main()  {
	client := &http.Client{}
	request,_ := http.NewRequest("GET", "http://xxx", nil)
	response,_ := client.Do(request)
	if response.StatusCode == 200{
		body, _ := ioutil.ReadAll(response.Body)
		bodyStr := string(body)
		fmt.Println(bodyStr)
		var api ApiData
		if err := json.Unmarshal([]byte(bodyStr), &api); err != nil{
			panic(err)
		}else {
			fmt.Println(api)
			fmt.Println(api.Result.CreditRule)
			data := api.Result.CreditRule
			//讲接口类型数据转为map数据类型
			a := data.(map[string]interface{})
			fmt.Println(a["1"])
		}
	}
}


